<html>
<head>
  <style>
div {
  height: 50px; width: 50px;
  float: left; margin-right: 10px;
  display: none; background-color: #090;
}
</style>
  <script src="jQuery/jquery1.7.1.js"></script>
</head>
<body>
 
<button>Go</button>
<p>Ready...</p>
<div></div>
<div></div>
<div></div>
<div></div>
 
 
<script>
$("button").bind( "click", function() {
  $("p").append( "Started...");
 
  $("div").each(function( i ) {
    $( this ).fadeIn().fadeOut( 1000 * (i+1) );
  });
 
  var a = "Jerry";
  $( "div" ).promise().done(function() {
    $( "p" ).append( " Finished! " + a );
  });
});
</script>
 
</body>
</html>